@echo off
set filePath=%1

rem 记录当前chcp
for /f "tokens=1,2,* delims=:" %%i in ('chcp') do call :SetChcp %%j
goto :eof

:SetChcp
SET currentChcp=%1
rem echo currentChcp=%currentChcp%
chcp 65001 > NUL

if "%filePath%"=="" (
    :CheckfilePath
  	set /p filePath=请输入class文件路径(输入0退出）：
)

if "%filePath%"=="0" (
    goto End
)


if "%filePath:~-5,5%" NEQ "class" (
    echo 输入的不是class文件，请输入正确的class文件路径(.class）
    goto CheckfilePath
)

javap -c -v %filePath% > %filePath%.asm

rem 恢复当前chcp
chcp %currentChcp% > NUL

echo file: %filePath%.txt

:eof

